package com.tingyuge.base.thread.wang.chapter3;

/**
 * Created by xiaodao
 * date: 2019/11/28
 */
public class CreateThread3 {

    private static int counter = 1;
    public static void main(String[] args) {
        Thread thread = new Thread(null, new Runnable() {
            @Override
            public void run() {
                try {
                    add(1);
                } catch (Error e) {

                    System.out.println(counter);
                    e.printStackTrace();
                }


            }
            public  void add(int i){
                counter++;
                add(i+1);

            }
        },"test" ,10);
        thread.start();
    }


}
